home *** CD-ROM | disk | FTP | other *** search
/ Cocktail Hour / image.iso / COCKTAIL.DIR / lists_136_recipe manager.ls < prev    next >
Encoding:
Text File  |  1997-03-05  |  4.6 KB  |  127 lines

  1. on readrecipes starting, ending
  2.   repeat with ii = starting to ending
  3.     put ii
  4.     updateStage()
  5.     set i to the name of member ii of castLib "recipes"
  6.     set RecipeNum to ii
  7.     repeat with j = 1 to the number of lines in the text of member "alco"
  8.       set tempAlco to line j of the text of member "alco"
  9.       if (the text of member i contains RETURN & tempAlco & " ") or (the text of member i contains " " & tempAlco & " ") then
  10.         if the text of field ("alco" & j) = EMPTY then
  11.           put RecipeNum into item 1 of field ("alco" & j)
  12.           next repeat
  13.         end if
  14.         set x to the number of items in field ("alco" & j)
  15.         put RecipeNum into item x + 1 of field ("alco" & j)
  16.       end if
  17.     end repeat
  18.     repeat with j = 1 to the number of lines in the text of member "non-alco"
  19.       set tempAlco to line j of the text of member "non-alco"
  20.       if (the text of member i contains RETURN & tempAlco & " ") or (the text of member i contains " " & tempAlco & " ") then
  21.         if the text of field ("non-alco" & j) = EMPTY then
  22.           put RecipeNum into item 1 of field ("non-alco" & j)
  23.           next repeat
  24.         end if
  25.         set x to the number of items in field ("non-alco" & j)
  26.         put RecipeNum into item x + 1 of field ("non-alco" & j)
  27.       end if
  28.     end repeat
  29.     repeat with j = 1 to the number of lines in the text of member "other"
  30.       set tempAlco to line j of the text of member "other"
  31.       if otherproc(i, tempAlco) = 1 then
  32.         if the text of field ("other" & j) = EMPTY then
  33.           put RecipeNum into item 1 of field ("other" & j)
  34.           next repeat
  35.         end if
  36.         set x to the number of items in field ("other" & j)
  37.         put RecipeNum into item x + 1 of field ("other" & j)
  38.       end if
  39.     end repeat
  40.     set tempSize to line 28 of the text of member i
  41.     if the text of member tempSize = EMPTY then
  42.       put RecipeNum into item 1 of field tempSize
  43.     else
  44.       if (field tempSize contains RecipeNum) = 0 then
  45.         set x to the number of items in field tempSize
  46.         put RecipeNum into item x + 1 of field tempSize
  47.       end if
  48.     end if
  49.     set tempTime to line 25 of the text of member i
  50.     if the text of member tempTime = EMPTY then
  51.       put RecipeNum into item 1 of field tempTime
  52.       next repeat
  53.     end if
  54.     if (field tempTime contains RecipeNum) = 0 then
  55.       set x to the number of items in field tempTime
  56.       put RecipeNum into item x + 1 of field tempTime
  57.     end if
  58.   end repeat
  59. end
  60.  
  61. on cleanmats starting, ending
  62.   repeat with ii = starting to ending
  63.     set i to the name of member ii of castLib "lists"
  64.     set the text of member i to EMPTY
  65.   end repeat
  66. end
  67.  
  68. on otherproc i, other
  69.   if (the text of member i contains RETURN & other) or (the text of member i contains " " & other) then
  70.     if other = "cream" then
  71.       set creamSet to offset("Cream", the text of member i)
  72.       if (offset("irish cream", the text of member i) + 6) = offset("cream", the text of member i) then
  73.         return 0
  74.       else
  75.         if (offset("icecream", the text of member i) + 3) = offset("cream", the text of member i) then
  76.           return 0
  77.         else
  78.           if (offset("ice cream", the text of member i) + 4) = offset("cream", the text of member i) then
  79.             return 0
  80.           else
  81.             return 1
  82.           end if
  83.         end if
  84.       end if
  85.     else
  86.       if (other = "apple") and (offset("apple", the text of member i) = (offset("pineapple", the text of member i) + 4)) then
  87.         return 0
  88.       else
  89.         if (other = "banana") and ((i = "recipe134") or (i = "recipe174")) then
  90.           return 1
  91.         else
  92.           if (other = "strawberry") and (i = "recipe174") then
  93.             return 1
  94.           else
  95.             if (the text of member "non-alco" contains other) or (the text of member "alco" contains other) then
  96.               set x to offset(other, the text of member i)
  97.               set xx to the number of chars in other + 2
  98.               set doubleApp to char x to x + xx of the text of member i
  99.               if (the text of member "non-alco" contains doubleApp) or (the text of member "alco" contains doubleApp) then
  100.                 return 0
  101.               else
  102.                 return 1
  103.               end if
  104.             else
  105.               return 1
  106.             end if
  107.           end if
  108.         end if
  109.       end if
  110.     end if
  111.   else
  112.     return 0
  113.   end if
  114. end
  115.  
  116. on setrecipenums
  117.   repeat with i = 1 to 174
  118.     set the name of member i of castLib "recipes2" to "recipe" & i
  119.   end repeat
  120. end
  121.  
  122. on richtofield
  123.   repeat with i = 1 to 174
  124.     set the text of member i of castLib "recipe fields" to the text of member i of castLib "recipes"
  125.   end repeat
  126. end
  127.